package bank.service.spring.department;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import bank.model.dao.DepartmentDAO;

public class DepartmentListController implements Controller {	
	public DepartmentListController(DepartmentDAO departmentDAO) {
		super();
		this.departmentDAO = departmentDAO;
	}

	public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
		System.out.println("This is DepartmentListController");		
		List departmentList = departmentDAO.getChildren(1);		
		request.setAttribute("enter", true);
		return new ModelAndView("department/departmentlist", "departmentList", departmentList);
	}
	
	private DepartmentDAO departmentDAO;
}